Spot Eye Modbus Communication Driver

 

Spot Eye Modbus is driver to communicate with Spot Eye of Koduct, Co., Ltd, in Korea.

 

1. Read settings

 

<Figure 1> is read setting example of Spot Eye Modbus communication driver.

<Figure 1> Read setting example of Spot Eye Modbus communication driver

Device Setting of <Figure 1> are input, Com Port(COM1), Com Baud(19200), Parity Bit(0), Data Bit(8), Stop Bit(1), according to device.

Also, enter whether to check CRC( 1 = Check, 0 = Not check ) of read packet at Option part of Spot Eye Modbus communication driver.

 

Spot Eye Modbus communication driver's read schedule

Read schedule setting parameters are as follows :

1)      STATION – Connected station(ID) number. (0 ~ 255)

2)      Read Data Type – Set the data type to read.

3 – Reading data of WORD unit,

3)      Read Start Address – Read start address. (Modbus address –1 )

4)      Save Start Address for Communication Server – Saving start address of Communication Server.

5)      Read Size - Number of data to read. ( WORD unit )

 

Read schedule example)

READ,     1,     3,     0,    0,  15,

 

If you click the icon 2 in protocol option part of <Figure 1>, you can see the dialog box such as <Figure 2>. You can also set read schedule by using this part.

<Figure 2> Example of Spot Eye Modbus driver's Option dialog box

You can set read schedule by using 3, 4, 5 button and listbox of <Figure 3>.

Also, you can set whether to check CRC of read packet at 'Check CRC Error' of <Figure 2>.

<Figure 3> Example of Spot Eye Modbus driver's read schedule Add/Edit dialog box

When you click Add button or Edit button in dialog box of <Figure 2>, dialog box of <Figure 3> is shown.

 

2. Writing settings

You can change  value of specific area by using writing setting of Spot Eye Modbus driver.

 

Digital Write

You can control Relay or set status value(reset, etc) of device by using digital output.

 

Digital write setting parameters are as follows :

1) PORT           Connected PORT number.

2) STATION      Station ( ID ) number of device.(0 ~ 255)

3) Address      Output or read start address. Output address of decimal number unit. (Modbus address – 1 )

4) Extra1          Data type which want to output or read.

15 – Data writing as BIT unit,

READ.x.y – x = Data type to read(Default = 3), y = Data size to read(Default = 15, WORD unit)

5) Extra2          When Extra1 is 15 : Don't care.

                       When Extra1 is READ.x.y : Start address to save read value.

 

Analog Write

You can send setting value to device as unit( such as WORD etc ) by using analog output.

 

Analog write setting parameters are as follows :

1) PORT           Connected PORT number.

2) STATION      Station( ID ) number of device.(0 ~ 255)

3) Address      Output or read start address. Output address of decimal number unit. (Modbus address – 1 )

4) Extra1          Data type which want to output or read.

16 – Data writing as WORD unit,

READ.x.y – x = Data type to read(Default = 3), y = Data size to read(Default = 15, WORD unit)

5) Extra2          When Extra1 is READ.x.y : Start address to save read value.

When value of Extra1 is 16 or etc value.

1 = Save Multi writing value,  ( Don't care about Extar1 part )

2 = Write Multi writing value as current saved value, ( Consecutive write as much as saved number from current set address )

3 = Delete all saved contents by using Multi writing value, ( Don't care about Extar1 part )

4 = Compare current saved value with PLC memory address value, ( Consecutive write as much as saved number from current set address )

Etc value( In case of larger than 0 or 4 ) = General( Single ) analog value writing

 

Write example 1)

PORT : 0   STATION : 1   ADDRESS : 0000  EXTRA1 : 16  EXTRA2 : 0

If you set as above and write analog value, you can set(WORD unit) no.0 address(first) value of N7 memory of Spot Eye Modbus device connected with no.0 port.

 

Write example 2)

PORT : 0   STATION : 1   ADDRESS : 0012  EXTRA1 : 16  EXTRA2 : 0

If you set as above and write analog value, you can set(2 WORD) no.12 address(13th) value of F8 memory of Spot Eye Modbus device connected with no.0 port as FLOAT unit.

 

Script writing example for Multi word writing settings)

$AO_0000.Extra2 = 3;                                            // Delete Multi writing value which was saved previously

@SetTagValue("AO_0000", 0);

 

$AO_0000.Extra2 = 1;                                            // Set as Multi writing value save

for(i = 0; i < 50; i = i + 1) {

   @sprintf($AO_0000.Extra1, "%03d", i);               // Set lest it ignore the same data by putting random value to Extra1

   @SetTagValue("AO_0000", 5000);                      // Save real output value, save randomly as 5000 here

}

@sprintf($AO_0000.Extra1, "16");              // Data type to output = Set as WORD unit

$AO_0000.Extra2 = 2;                                            // Designate Multi writing value

@SetTagValue("AO_0000", 1);                               // Write value, write value of 50 from designated address

 

Script writing example for confirming the current value of PLC and memory value that are same or not)

$AO_CHECK_MEM_SET = 2;                                     // Set WORD address for confirming comparison/completion, as 2

for(i = 0; i < 1; ) {

   if($AI_CHECK_WRITE_STATUS == 2) i = 10;           // Writing the value of 2 is completed.

   @TagCheckLoop();                                             // Function that confirms tag value change

}

 

$AO_0000.Extra2 = 3;                                                // Delete previous saved data value

@SetTagValue("AO_0000", 0);

 

$AO_0000.Extra2 = 1;                                                // Set as data value save

for(i = 0; i < 50; i = i + 1) {

   @sprintf($AO_0000.Extra1, "%03d", i);                   // Set lest it ignore the same data by putting random value to Extra1

   @SetTagValue("AO_0000", 5000);                         // Save the value to compare, save randomly as 5000 here

}

@sprintf($AO_0000.Extra1, "16");                               // Data type to compare = Set as WORD

$AO_0000.Extra2 = 4;                                                // Data value comparison designation

@SetTagValue("AO_0000", 1);                                   // From designated address, command for comparing data as much as entered

 

for(i = 0; i < 1; ) {

   if($AI_CHECK_WRITE_STATUS == 1) i = 10;           // Result of comparison 1 = Same data

   if($AI_CHECK_WRITE_STATUS == 0) {                  // Result of comparison 0 = Other data exist

      @MessageBox("Comparison data is different each other.", "Data comparison error", MB_OK);

      return;

   }

   @TagCheckLoop();                                             // Confirmation function for tag value change

}

@MessageBox("Comparison data is same.", "Data comparison complete", MB_OK);

 

Notice when write the script for comparison)

1) Save the result of comparison to WORD memory address which is set at Option part as 1 ( same data ), 0 ( different data ).

2) Confirm the comparison results by first entering the value( at example, value is 2 ) except 1 and 0 to WORD address which is set before comparing with current value of device.

3) AO_CHECK_MEM_SET analog output tag is set to forcedly output WORD address which is set at option part. ( Set as Extra1 = #MEM# )

4) Attune AI_CHECK_WRITE_STATUS analog input tag to WORD address which is set by PLC_SCAN tag.

 

Block Write

Block Writing is set as follows by using PlcScanWriteBlock function of script. Block Writing can use WORD(ushort) unit only.

Script name and format : @PlcScanWriteBlock(int port, int station, int address, string extra1, string extra2, object array_value, int array_size);

Example of writing a script( In case of setting 15 WORD(0 ~ 14 address) as 1, 1000, 100, 20, 0, 15, 0, 0, ... by using Block Writing )

ushort   writeVal[15];

 

val[0] =1;

val[1] = 1000;

val[2] = 100;

val[3] = 20;

val[4] = 0;

val[5] = 15;

@PlcScanWriteBlock(0, 1, 0, "16", "", writeVal, 15);

 

Importance) Spot Eye Modbus driver's Block Write can use WORD unit only.

                         Also, Block Write is supported at over 10.1.4.3 version.

 

3. Appearance of Spot Eye Modbus device

<Figure 4> is appearance of Spot Eye Modbus device.

<Figure 4> Appearance of Spot Eye Modbus device